package com.haoxin.ai_course.modules.course.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.haoxin.ai_course.modules.course.entity.AcStatisticsUser;

/**
 * 用户统计表
 * 
 * @author xingxiangguo
 * @email bugcn@qq.com
 * @date 2022-06-06 09:44:49
 */
public interface AcStatisticsUserMapper  extends BaseMapper<AcStatisticsUser> {
	@Select("select max(revisit_times) + 1 from ac_statistics_user where user_id=#{userId} and course_id=#{courseId}")
	Integer getMaxRevisitTimes(@Param("userId") Long userId, @Param("courseId") Integer courseId);
	
	@Select("select count(1) from ac_course_node where node_format=3  and course_id = #{courseId}")
	Integer getTopicCountByCourseId(@Param("courseId")  Integer courseId);
	@Delete (" delete from ac_course_user; ")
	void clearStatisticsData1();
	@Delete("delete from ac_data_record;")
	void clearStatisticsData2();
	@Delete("delete from ac_node_user;")
	void clearStatisticsData3();
	@Delete("delete from ac_score;")
	void clearStatisticsData4();
	@Delete("delete from ac_statistics_answer;")
	void clearStatisticsData5();
	@Delete("delete from ac_statistics_article;")
	void clearStatisticsData6();
	@Delete("delete from ac_statistics_course;")
	void clearStatisticsData7();
	@Delete   (" delete from ac_statistics_course_detail; ")
	void clearStatisticsData8();
	@Delete    (" delete from ac_statistics_user;  ")
	void clearStatisticsData9();
	@Delete    (" delete from ac_topic_answer_result;  ")
	void clearStatisticsData10();
	@Delete    (" delete from ac_article_count;  ")
	void clearStatisticsData11();
}
